/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "DEPENDENCIA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Dependencia.findAll", query = "SELECT d FROM Dependencia d"),
    @NamedQuery(name = "Dependencia.findByDepCod", query = "SELECT d FROM Dependencia d WHERE d.depCod = :depCod"),
    @NamedQuery(name = "Dependencia.findByDepNom", query = "SELECT d FROM Dependencia d WHERE d.depNom = :depNom"),
    @NamedQuery(name = "Dependencia.findByFacCod", query = "SELECT d FROM Dependencia d WHERE d.facCod = :facCod")})
public class Dependencia implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "DEP_COD")
    private Integer depCod;
    @Basic(optional = false)
    @Column(name = "DEP_NOM")
    private String depNom;
    @Column(name = "FAC_COD")
    private String facCod;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "depCod", fetch = FetchType.LAZY)
    private List<SubDependencia> subDependenciaList;
    @OneToMany(mappedBy = "depCod", fetch = FetchType.LAZY)
    private List<IngresoEgreso> ingresoEgresoList;

    public Dependencia() {
    }

    public Dependencia(Integer depCod) {
        this.depCod = depCod;
    }

    public Dependencia(Integer depCod, String depNom) {
        this.depCod = depCod;
        this.depNom = depNom;
    }

    public Integer getDepCod() {
        return depCod;
    }

    public void setDepCod(Integer depCod) {
        this.depCod = depCod;
    }

    public String getDepNom() {
        return depNom;
    }

    public void setDepNom(String depNom) {
        this.depNom = depNom;
    }

    public String getFacCod() {
        return facCod;
    }

    public void setFacCod(String facCod) {
        this.facCod = facCod;
    }

    @XmlTransient
    public List<SubDependencia> getSubDependenciaList() {
        return subDependenciaList;
    }

    public void setSubDependenciaList(List<SubDependencia> subDependenciaList) {
        this.subDependenciaList = subDependenciaList;
    }

    @XmlTransient
    public List<IngresoEgreso> getIngresoEgresoList() {
        return ingresoEgresoList;
    }

    public void setIngresoEgresoList(List<IngresoEgreso> ingresoEgresoList) {
        this.ingresoEgresoList = ingresoEgresoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (depCod != null ? depCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Dependencia)) {
            return false;
        }
        Dependencia other = (Dependencia) object;
        if ((this.depCod == null && other.depCod != null) || (this.depCod != null && !this.depCod.equals(other.depCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.Dependencia[ depCod=" + depCod + " ]";
    }
    
}
